package com.sefon.autocreate;

import java.io.Serializable;

/**
 * 
* Copyright: Copyright (c) 2018 SefonSoft
* 
* @ClassName: Column.java
* @Description: 列对象
*
* @version: v1.0.0
* @author: SF2170
* @date: 2018年3月22日上午1:42:39
*
 */
public class Column  implements Serializable{
	/**
	 *  @Fields serialVersionUID : TODO
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * 数据类型
	 */
	enum TYPE {
		VARCHAR("varchar","varchar", "String"),
		LONG("bigint", "long", "Long"),
		INT("int", "int", "Integer"),
		BIGINT("bigint", "bigint", "Long"),
		DOUBLE("double","double", "Double"),
		DATE("date", "date", "Date"),
		DATETIME("datetime", "datetime", "Date"),
		TIMESTAMP("timestamp", "timestamp", "Date"),
		TEXT("text", "text", "String"),
		LONGTEXT("longtext", "longtext", "String");
		/**
		 * key对应excel文件中的值 且唯一
		 */
		private String key;
		/**
		 * name对应数据库中的值
		 */
		private String name;
		/**
		 * name对应数据库中的值
		 */
		private String javaName;
		private TYPE(String name, String key, String javaName) {
			this.key= key;
			this.name= name;
			this.javaName= javaName;
		}
		public String getName() {
			return name;
		}
		public String getJavaName() {
			return javaName;
		}
		public String getKey() {
			return key;
		}
		public static TYPE getTypeByKey(String key ) {
			for ( TYPE type : TYPE.values() ) {
				if ( type.getKey().equals(key) ) {
					return type;
				}
			}
			return null;
		}
		
	}
	/**
	 * 列名
	 */
	private String name;
	/**
	 * 类列名
	 */
	private String fieldName;
	/**
	 * 长度
	 */
	private String length;
	/**
	 * 类型
	 */
	private TYPE type;
	/**
	 * 描述
	 */
	private String desc;
	/**
	 * 是否唯一
	 */
	private Boolean unique;
	/**
	 * 是否id
	 */
	private Boolean isId; 
	/**
	 * 是否可以为空
	 */
	private Boolean isNull;
	
	/**
	 * 注释
	 */
	private String annotation;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getLength() {
		return length;
	}
	public void setLength(String length) {
		this.length = length;
	}
	
	public TYPE getType() {
		return type;
	}
	public void setType(TYPE type) {
		this.type = type;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
	public Boolean getUnique() {
		return unique;
	}
	public void setUnique(Boolean unique) {
		this.unique = unique;
	}
	public Boolean getIsId() {
		return isId;
	}
	public void setIsId(Boolean isId) {
		this.isId = isId;
	}
	public Boolean getIsNull() {
		return isNull;
	}
	public void setIsNull(Boolean isNull) {
		this.isNull = isNull;
	}
	public String getFieldName() {
		return fieldName;
	}
	public void setFieldName(String fieldName) {
		this.fieldName = fieldName;
	}
	public String getAnnotation() {
		return annotation;
	}
	public void setAnnotation(String annotation) {
		this.annotation = annotation;
	} 
	
	
}
